package persistence.repository;

import java.util.Date ;

import persistence.PersistenceController ;
import util.Log ;
import util.Subsystem ;
import domain.user.Login ;

/**
 * repository for statistics.
 *
 * @author idan
 */
public class LoginRepository extends Repository<Login>
{
	/**
	 * @param persistence persistence provider to store objects.
	 * @pre 'persistence' persists objects of type 'Statistics'.
	 */
	public LoginRepository(final PersistenceController persistence)
	{
		super(persistence) ;
	}

	/**
	 * @param memberId id of the member who logged in.
	 * @param loginTime time in which the member logged in.
	 * @return the created login object.
	 */
	public Login create(final long memberId, final Date loginTime)
	{
		final Login login = new Login(memberId, loginTime) ;
		this.put(login) ;
		Log.getLogger(Subsystem.REPOSITORY).finest("new login created.") ;
		return login ;
	}
}